function AJAX(type,url,data,){
	var xhr = null;
	if(window.XMLHttpRequest){
		xhr = new XMLHttpRequest()
	}else{
		xhr = new ActiveXObject('Microsoft.XMLHTTP');
	}
	if(type == 'GET'){
		if(data){
			xhr.open('GET',url+'?'+data,true)
		}else{
			xhr.open('GET',url,true)
		}
		xhr.send();
	}else{
		xhr.open('POST',url,true);
		xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded')
		xhr.send(data)
	}
	
	return new Promise(function(resolve,reject){
		xhr.onreadystatechange = function(){
			if(xhr.status == 200 && xhr.readyState ==4){
				resolve(xhr.responseText)
			}
		}
		
	})
	
}